import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import './assets/css/index.css'


//引入vue-quill-editor富文本编辑器
import VueQuillEditor from 'vue-quill-editor'

//引入vue-quill-editor富文本编辑器css样式
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
//绘图
import * as echarts from 'echarts'

import MianBaoXie from '@/assets/components/Mbx'
// import * as API from '@/http/api'
// 时间过滤器
// import moment from 'moment'
// Vue.prototype.$API = API
Vue.component('MBX', MianBaoXie)
    //绘图
Vue.prototype.$echarts = echarts
    //注册
Vue.use(VueQuillEditor)

//表格级联菜单
import  TreeTable  from  'vue-table-with-tree-grid'

Vue.config.productionTip  =  false

Vue.component('tree-table',  TreeTable)
    //时间过滤器
    // Vue.filter('time', function(value, formatString) {
    //     formatString = formatString || 'YYYY-MM-DD HH:mm';
    //     return moment(value).format(formatString);
    // })

//定义全局过滤器，过滤用户等级
Vue.filter('qx', function(v) {
    console.log('要处理的值', v);

    //定义变量
    let result;

    //使用switch语句
    switch (v * 1) {
        case 0:
            result = '一级权限';
            break;
        case 1:
            result = '二级权限';
            break;
        case 2:
            result = '三级权限';
            break;
        default:
            result = '没有权限等级';
    }

    //需要return返回 v
    return result;
})



//定义事件过滤器
Vue.filter('shijianfilter', function(value) {
    let gettime = ''
    const date = new Date(value)
    const yy = date.getFullYear()
    const mm = date.getMonth() + 1
    const dd = date.getDate()
    const hh = date.getHours()
    const mf = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
    const ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
    gettime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
    return gettime
})

import '@/assets/iconfont/iconfont.css'
Vue.config.productionTip = false

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')